home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug172 / lmovb.c < prev    next >
C/C++ Source or Header  |  1986-02-05  |  1KB  |  47 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     LEX - A Lexical Analyser Generator
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      Jan 30, 1985
  6.   DESCRIPTION:     A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:     Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      LMOVB.C
  10.   WARNINGS:     This program is not for the casual user. It will
  11.          be useful primarily to expert developers.
  12.   CRC:         N/A
  13.   SEE-ALSO:     YACC and PREP
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18. /*
  19.  * Bob Denny     28-Aug-82  Remove reference to stdio.h
  20.  * Scott Guthery 20-Nov-83    Adapt for IBM PC & DeSmet C
  21.  */
  22.  
  23. #include <lex.h>
  24.  
  25. _lmovb(lp, c, st)
  26. register c, st;
  27. register struct lextab *lp;
  28. {
  29.         int base;
  30.  
  31.         while ((base = lp->llbase[st]+c) > lp->llnxtmax ||
  32.                         (lp->llcheck[base] & 0377) != st) {
  33.  
  34.                 if (st != lp->llendst) {
  35. /*
  36.  * This miscompiled on Decus C many years ago:
  37.  *                      st = lp->lldefault[st] & 0377;
  38.  */
  39.                         base = lp->lldefault[st] & 0377;
  40.                         st = base;
  41.                 }
  42.                 else
  43.                         return(-1);
  44.         }
  45.         return(lp->llnext[base]&0377);
  46. }
  47.